import request from "@/utils/request.js";

// 文章列表分类查询
export const articleCategoryListService = () => {
    // 通过请求头 Authorization 携带 token
    return request.get("/category");
};

// 添加文章
export const addArticleCategoryService = categoryModel => {
    return request.post("/category", categoryModel);
};

// 编辑文章
export const editArticleCategoryService = categoryModel => {
    return request.put("/category", categoryModel);
};

// 删除文章
export const deleteArticleCategoryService = id => {
    return request.delete("/category?id=" + id);
};

// 文章列表查询
export const articleListService = params => {
    return request.get("/article", { params: params });
};

// 添加文章
export const addArticleService = articleModel => {
    return request.post("/article", articleModel);
};

// 更新文章
export const updateArticleService = articleModel => {
    return request.put("/article", articleModel);
};

// 删除文章
export const deleteArticleService = id => {
    return request.delete("/article?id=" + id);
};
